package com.authine.cloudpivot.ext.service;


import com.authine.cloudpivot.ext.service.ipml.*;
import com.authine.cloudpivot.foundation.orm.api.dml.JPANativeQuery;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.util.List;
import java.util.Map;

@Component
@Slf4j
public class TimeOutRemind {


    @Autowired
    BlowWhistleEvent2ServiceIpml blowWhistleEvent2ServiceIpml;

    @Autowired
    SyncResidentServiceImpl syncResidentService;


    @Autowired
    SyncErrorDataServiceImpl syncErrorDataService;

    @Autowired
    SyncBaseDataUpdateLogServiceImpl syncBaseDataUpdateLogService;

    @Autowired
    SyncKeyProjectServiceImpl syncKeyProjectService;

    @Autowired
    SyncPetitionresidentImpl   syncPetitionresident;

    @Scheduled(cron = "0 */10 * * * ?")
    public void timedOutToDo() {
        log.info("定时任务开始执行");
        blowWhistleEvent2ServiceIpml.pushTimedOutToDo();
        log.info("定时任务结束执行");
    }

    @Scheduled(cron = "0 0 23 1 * ?")
    public void syncPeopleAge(){
        syncResidentService.syncResidentAge();
    }

    /**
     * 雪亮一小时数据处理
     */
    @Scheduled(cron = "0 0 */1 * * ?")
    public void checkOneHouseData(){
        log.info("雪亮关联吹哨定时任务开始执行");
        syncErrorDataService.syncErrorData();
        log.info("雪亮关联吹哨定时任务开始执行");
    }

    @Scheduled(cron = "0 0 1 * * ?")
    public void syncUpdateLog(){
        syncBaseDataUpdateLogService.syncBaseDataUpdateLog();
    }

    @Scheduled(cron = "0 10 9 * * ?")
    public void setSyncKeyProject(){
        syncKeyProjectService.notice(false);
    }

    @Scheduled(cron = "0 0 0 1 * ?")
    public void xfTimeOut(){
        syncPetitionresident.notice();
    }


    @Scheduled(cron = "0 0 */1 * * ?")
    public void sfmy(){
        syncBaseDataUpdateLogService.syncChuishao();
    }

    @Scheduled(cron = "0 0 1 * * ?")
    public void userTotal(){
        syncBaseDataUpdateLogService.userTotal();
    }


    @Scheduled(cron = "0 0 9 * * ?")
    public void processAlarmData() {
        syncErrorDataService.processCs(null,null);
    }

    @Scheduled(cron = "0 0 */1 * * ?")
    public void gjcsTimeOut(){
        syncErrorDataService.pushTimedOutToDo();
    }

}
